package com.biz.primus.ms.adv.trans;

import com.biz.primus.ms.adv.dao.po.Advertisement;
import com.biz.primus.ms.adv.dao.ro.AdvertisementRo;
import com.google.common.base.Function;

/**
 * 广告PO转换RO
 * PO------>RO
 *
 * @author jun.liu
 * @date 2017/9/18
 */
public class Advertisement2AdvertisementRo implements Function<Advertisement, AdvertisementRo> {


    @Override
    public AdvertisementRo apply(Advertisement input) {
        AdvertisementRo ro = new AdvertisementRo();
        ro.setId(input.getId());
        ro.setTitle(input.getTitle());
        ro.setAtype(input.getAtype());
        ro.setUrl(input.getUrl());
        ro.setSourcePath(input.getSourcePath());
        ro.setBeginDate(input.getBeginDate());
        ro.setEndDate(input.getEndDate());
        if (input.getAdPosition() != null) {
            ro.setAdPositionId(String.valueOf(input.getAdPosition().getId()));
        }
        ro.setSupportedGeoId(input.getSupportedGeoId());
        ro.setCountryStatus(input.isCountryStatus());
        ro.setSecond(input.getSecond());
        return ro;
    }
}
